//
// Created by LanK on 2025/1/1.
//
#include <stdio.h>
#include <stdlib.h>

struct Node {
    int data;
    struct Node *next;
};

int main() {
    int n,m;
    scanf("%d", &n);
    struct Node *head,*p;
    head = (struct Node *)malloc(sizeof(struct Node));
    head->next = NULL;
    while (scanf("%d", &m) && m >= 0) {
        p = (struct Node *)malloc(sizeof(struct Node));
        p->data = m;
        p->next = head->next;
        head->next = p;
    }
    for (int i = 0; i < n; ++i) {
        head = head->next;
    }
    if (head) {
        printf("%d\n", head->data);
    }else {
        printf("NULL");
    }
}